#include "GPIO_drv.h"

inline static void GPIOA_SetUp(void)
{
	/* Enable RCC for Port A */
	SET_BIT((RCC->AHB1ENR),ONE_32);

	GPIOA->MODER 	= GPIOA_MODER;
	GPIOA->PUPDR 	= GPIOA_PULL;
	GPIOA->OTYPER 	= GPIOA_OTYPER;
	GPIOA->OSPEEDR	= GPIOA_SPEED;
	GPIOA->AFR[0]	= GPIOA_AFL;
	GPIOA->AFR[1]	= GPIOA_AFH;
	return;
}

inline static void GPIOB_SetUp(void)
{
	/* Enable RCC for Port B */
	SET_BIT((RCC->AHB1ENR),((UIN32) 2u));

	GPIOB->MODER 	= GPIOB_MODER;
	GPIOB->PUPDR 	= GPIOB_PULL;
	GPIOB->OTYPER 	= GPIOB_OTYPER;
	GPIOB->OSPEEDR	= GPIOB_SPEED;
	GPIOB->AFR[0]	= GPIOB_AFL;
	GPIOB->AFR[1]	= GPIOB_AFH;

	return;
}

inline static void GPIOC_SetUp(void)
{
	/* Enable RCC for Port C */
	SET_BIT((RCC->AHB1ENR),((UIN32) 4u));

	GPIOC->MODER 	= GPIOC_MODER;
	GPIOC->PUPDR 	= GPIOC_PULL;
	GPIOC->OTYPER 	= GPIOC_OTYPER;
	GPIOC->OSPEEDR	= GPIOC_SPEED;
	GPIOC->AFR[0]	= GPIOC_AFL;
	GPIOC->AFR[1]	= GPIOC_AFH;
	return;
}

inline static void GPIOD_SetUp(void)
{
	/* Enable RCC for Port D */
	SET_BIT((RCC->AHB1ENR),((UIN32) 8u));

	GPIOD->MODER 	= GPIOD_MODER;
	GPIOD->PUPDR 	= GPIOD_PULL;
	GPIOD->OTYPER 	= GPIOD_OTYPER;
	GPIOD->OSPEEDR	= GPIOD_SPEED;
	GPIOD->AFR[0]	= GPIOD_AFL;
	GPIOD->AFR[1]	= GPIOD_AFH;
	return;
}

static void GPIOE_SetUp(void)
{
	/* Enable RCC for Port E */
	SET_BIT((RCC->AHB1ENR),((UIN32) 16u));

	GPIOE->MODER 	= GPIOE_MODER;
	GPIOE->PUPDR 	= GPIOE_PULL;
	GPIOE->OTYPER 	= GPIOE_OTYPER;
	GPIOE->OSPEEDR	= GPIOE_SPEED;
	GPIOE->AFR[0]	= GPIOE_AFL;
	GPIOE->AFR[1]	= GPIOE_AFH;

	return;
}

void GPIO_drv_Init(void)
{
	//GPIOA_SetUp();
	GPIOB_SetUp();
	GPIOC_SetUp();
	GPIOD_SetUp();
	GPIOE_SetUp();
	return;
}
